import request from '../utils/request.js'

const FONT_PREFIX = '/front/member'
const BACK_PREFIX = '/cloudgallery/member'

export default {

	/**
	 * 登录
	 * {
  "password": "1",
  "username": ""
}
	 */
	user_login(user) {
		return request({
			url: `${FONT_PREFIX}/login`,
			method: 'post',
			data: user
		})
	},

	/**
	 * 根据 token 获取用户信息
	 */
	user_info() {
		return request({
			url: `${FONT_PREFIX}/getMemberInfo`,
			method: 'get'
		})
	},

	/**
	 * 注册
	 * @param {Object} user
	 */
	user_register(user) {
		return request({
			url: `${BACK_PREFIX}/save`,
			method: 'post',
			data: user
		})
	},

	/**
	 * 修改
	 * @param {Object} user
	 * 
	 */
	user_update(user) {
		return request({
			url: `${BACK_PREFIX}/update`,
			method: 'post',
			data: user
		})
	},

	/**
	 * 模糊查询——名称是否被占用
	 * @param {Object} obj
	 */
	user_query(obj) {
		return request({
			url: `${BACK_PREFIX}/list`,
			method: 'get',
			params: obj
		})
	}
}
